﻿using System;
using Microsoft.Data.Sqlite;

namespace FlexField.Metadata.EFCore.Tests
{
    public class InMemoryDatabaseFixture : IDisposable
    {
        private readonly SqliteConnection _connection = new("DataSource=:memory:");

        public InMemoryDatabaseFixture()
        {
            _connection.Open();
        }

        public SqliteConnection Connection => _connection;

        public void Dispose()
        {
            _connection.Close();
            _connection.Dispose();
        }
    }
}
